package com.example.tidycalendartest;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
	protected static final String DATABASE_NAME = "Calendar.db";
	protected static final int DATABASE_VERSION = 1;

	public DatabaseHelper(Context context)
	{
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	public DatabaseHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);		
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		createDatabase(db);
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}
	
	
	public void createDatabase(SQLiteDatabase db)
	{
		db.execSQL("CREATE TABLE events (event_id INTEGER, name VARCHAR(255), description VARCHAR(255), category_id INTEGER, start_date DATE, end_date DATE)");	
		
	}
	
	public void destroyDatabase(SQLiteDatabase db)
	{
		db.execSQL("DROP TABLE IF EXISTS events");
		
	}
	
}
